<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.js"></script>
</head>
<body>
<input type="file" id="file" name="file" multiple/>
<button id="button" name="">上传</button>
<br><br>
<button id="button2" name="">流控测试</button>
</body>
</html>
<script>
    $(function () {
        $("#button").click(function () {
            var formData = new FormData();
            for (let file of document.getElementById("file").files) {
                formData.append("file", file);
            }
            var account = JSON.stringify({
                "accountName": "abc123",
                "amount": "16"
            });
            formData.append('account', new Blob([account], {type: "application/json"}));
            formData.append('testdata', '123')
            $.ajax({
                url: "http://localhost:8060/account/upload/test",
                type: "post",
                //忽略contentType
                contentType: false,
                //取消序列化 formData本来就是序列化好的
                processData: false,
                dataType: "json",
                data: formData,
                success: function (response) {
                    alert(response);
                },
                error: function () {

                }
            });
        });

        $("#button2").click(function () {
            $.ajax({
                url: "http://localhost:8060/account/getByCode?accountCode=javadaily",
                type: "get",
                dataType: "json",
                success: function (response) {
                    if (response.code !== '00000000') {
                        console.log(response.msg)
                    } else {
                        console.log(response.data)
                    }
                },
                error: function () {

                }
            });
        });
    })
</script>